﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Import Namespace="AgriMarketWebProj.Models" %>
<%@ Import Namespace="System.Web.Script.Serialization" %>
<%@ Import Namespace="System.Web.Helpers" %>
<%@ Import Namespace="AgriMarketWebProj.AgriMarketService" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    AgriMarket|Quản trị đấu giá
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="Content" runat="server">

<h2>AddAuction</h2>
    <%List<Product> allProducts = ViewBag.AllProducts; %>
    <%List<TypeOfAuction> allTypes = ViewBag.AllTypeOfAuctions; %>
    <%JavaScriptSerializer serializer = new JavaScriptSerializer(); %>
    <%: Html.ValidationSummary(false)%>
    <%if (allTypes.Count > 0 && allTypes.Count > 0)
      { %>
    <form method="post" action="/AuctionAdmin/Create" enctype = "multipart/form-data">
        <fieldset>
            <legend>Auction</legend>
    
            <div class="editor-label">
                Types Of Auction
            </div>
            <div class="editor-label">
            <select name='TypeOfAuctionId'>
            <%
                foreach (var type in allTypes)
                {
                    Response.Write("<option value='" + type.TypeId + "'>" + type.TypeName + "</option>");
                }
            %>
            </select>
            </div>
                    
            <div class="editor-label">
                Topic
            </div>
            <div class="editor-field">
                <input type='text' name='Topic' />
            </div>
    
            <div class="editor-label">
                Giá khởi điểm
            </div>
            <div class="editor-field">
                <input type='text' name='InitialPrice' />
            </div>
    
            <div class="editor-label">
                Mô tả
            </div>
            <div class="editor-field">
                <textarea name='ProductDescription'></textarea>
            </div>
    
            <div class="editor-label">
                Ngày bắt đầu
            </div>
            <div class="editor-field">
                <input type='text' name='StartedDate' id='StartedDate' />
                <img src='../../External/DatetimePicker/images2/cal.gif' onclick='javascript:NewCssCal(&apos;StartedDate&apos;,&apos;&apos;,&apos;ddMMyyyy&apos;,&apos;dropdown&apos;,true,&apos;12&apos;,true)' style='cursor:pointer'/>
            </div>
    
            <div class="editor-label">
                Ngày kết thúc
            </div>
            <div class="editor-field">
                <input type='text' name='FinishedDate' id='FinishedDate' />
                <img src='../../External/DatetimePicker/images2/cal.gif' onclick='javascript:NewCssCal(&apos;FinishedDate&apos;,&apos;&apos;,&apos;ddMMyyyy&apos;,&apos;dropdown&apos;,true,&apos;12&apos;,true)' style='cursor:pointer'/>
            </div>
    
            <div class="editor-label">
                Ảnh
            </div>
            <div class="editor-field">
                <div name='ProductImageDiv' id='ProductImageDiv'>
                <%= "<img src='../../Content/TempProductImage.jpg' width=200px />"%>
                </div>
                <input type="file" name='ProductImageFile' id='ProductImageFile' />
            </div>
            <div class="editor-label">
                Product
            </div>
            <div class="editor-field">
                    <select name="ProductId" id="ProductId">
                        <%
                        foreach (var product in allProducts)
                        {
                            Response.Write("<option value='" + product.ProductId + "' >" + product.ProductName + "</option>");
                        }
                        %>
                    </select>
            </div>
            <div class="editor-label">
                Tác giả:
            </div>
            <div class="editor-field">
                <input type='text' name='AuthorId' id='AuthorId' />
            </div>
            <p>
                <input type="submit" value="Save" />
            </p>
        </fieldset>
    </form>
    <%} %>
    <div>
        <%: Html.ActionLink("Back to List", "Index") %>
    </div>
         
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <script src="../../Scripts/AgriProj/AuctionAdmin/AddAuction.js" type="text/javascript"></script>
</asp:Content>
